---
title: Obtain Google Service Account Keys using FCM V1
sidebar_title: Add Android FCM V1 credentials
description: Learn how to create or use a Google Service Account Key for sending Android Notifications using FCM.
---

import { ContentSpotlight } from '~/ui/components/ContentSpotlight';
import { Step } from '~/ui/components/Step';
import { Tab, Tabs } from '~/ui/components/Tabs';

## Create a new Google Service Account Key

Here are the steps to configure a new Google Service Account Key in EAS for sending Android Notifications using FCM V1.

<Step label="1">

Create a new Firebase project for your app in the [Firebase Console](https://console.firebase.google.com). If you already have a Firebase project for your app, continue to the next step.

<ContentSpotlight
  alt="Create a project in the Firebase Console"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/01-new-firebase-project.png"
  className="max-w-[800px]"
/>

</Step>

<Step label="2">

In the Firebase console, open **Project settings** > [**Service accounts**](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk) for your project.

<ContentSpotlight
  alt="Service accounts settings tab in Firebase console"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/02-manage-service-accounts.png"
  className="max-w-[800px]"
/>

</Step>

<Step label="3">

Click **Generate New Private Key**, then confirm by clicking **Generate Key**. Securely store the JSON file containing the private key.

<ContentSpotlight
  alt="Generate a new private key in the Firebase Console"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/03-generate-key.png"
  className="max-w-[800px]"
/>

</Step>

<Step label="4">

Upload the JSON file to EAS and configure it for sending Android notifications. This can be done using EAS CLI or in [EAS dashboard](https://expo.dev).

<Tabs tabs={["EAS CLI", "expo.dev"]}>

<Tab>

- Run `eas credentials`
- Select `Android` > `production` > `Google Service Account`
- Select `Manage your Google Service Account Key for Push Notifications (FCM V1)`
- Select `Set up a Google Service Account Key for Push Notifications (FCM V1)` > `Upload a new service account key`
- If you've previously stored the JSON file in your project directory, the EAS CLI automatically detects the file and prompts you to select it. Press <kbd>Y</kbd> to continue.

> **Note**: Add the JSON file to your version source control's ignore file (for example, **.gitignore**) to avoid committing it to your repository since it contains sensitive data.

</Tab>

<Tab>

- Under **Project settings**, click [**Credentials**](https://expo.dev/accounts/[account]/projects/[project]/credentials) in the navigation menu
- For **Android**, click **Add Application Identifier** or select an existing **Application identifier**
- Under **Service Credentials** > **FCM V1 service account key**, click **Add a service account key**

<ContentSpotlight
  alt="Project credentials page on expo.dev"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-1.png"
  className="max-w-[800px]"
/>

- Under **Upload new key**, upload your JSON credential and click **Save**

<ContentSpotlight
  alt="Save the service account key file to the project"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-2.png"
  className="max-w-[480px]"
/>

</Tab>

</Tabs>

</Step>

<Step label="5">

Configure the **google-services.json** file in your project. Download it from the Firebase Console and place it at the root of your project directory.

This file is required for your Android app to be registered with FCM. You may commit this file to your repository since it contains public-facing identifiers from your Firebase project.

**Note**: You can skip this step if **google-services.json** has already been set up.

<ContentSpotlight
  alt="Download google-services.json from Firebase Cloud Console"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/05-setup-google-services-json.png"
  className="max-w-[800px]"
/>

In **app.json**, add [`expo.android.googleServicesFile`](/versions/latest/config/app/#googleservicesfile) with its value as the path of the **google-services.json**.

```json app.json
{
  "expo": {
  /* @hide ...*/ /* @end */
  "android": {
    /* @hide ...*/ /* @end */
    "googleServicesFile": "./path/to/google-services.json"
  }
}
```

</Step>

<Step label="6">

You're all set! You can now send notifications to Android devices via Expo Push Notifications using the FCM V1 protocol.

<ContentSpotlight
  alt="Service account key successfully uploaded"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/06-upload-credential-complete.png"
  className="max-w-[800px]"
/>

</Step>

## Use an existing Google Service Account Key

<Step label="1">

Open the [IAM Admin page](https://console.cloud.google.com/iam-admin/iam?authuser=0) in Google Cloud Console. In the Permissions tab, locate the **Principal** you intend to modify and click the pencil icon for **Edit Principal**.

<ContentSpotlight
  alt="Edit Principal in IAM Admin page in Google Cloud Console"
  src="/static/images/creating-google-service-account/fcm-v1/existing-service-account/01-iam-admin-page.png"
  className="max-w-[800px]"
/>

</Step>

<Step label="2">
Click **Add Role** and select the **Firebase Messaging API Admin** role from the dropdown. Click **Save**.

<ContentSpotlight
  alt="Assign roles"
  src="/static/images/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-1.png"
  className="max-w-[800px]"
/>

<ContentSpotlight
  alt="Select the Firebase Messaging API Admin role"
  src="/static/images/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-2.png"
  className="max-w-[800px]"
/>

<ContentSpotlight
  alt="Save the role assignment"
  src="/static/images/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-3.png"
  className="max-w-[800px]"
/>

</Step>

<Step label="3">

You have to specify to EAS which JSON credential file to use for sending FCM V1 notifications, using EAS CLI or in [EAS dashboard](https://expo.dev). You can upload a new JSON file or select a previously uploaded file.

<Tabs tabs={["EAS CLI", "expo.dev"]}>

<Tab>

- Run `eas credentials`
- Select `Android` > `production` > `Google Service Account`
- Select `Manage your Google Service Account Key for Push Notifications (FCM V1)`
- Select `Set up a Google Service Account Key for Push Notifications (FCM V1)` > `Upload a new service account key`
- The EAS CLI automatically detects the file on your local machine and prompts you to select it. Press <kbd>Y</kbd> to continue.

> **Note**: Add the JSON file to your version source control's ignore file (for example, **.gitignore**) to avoid committing it to your repository since it contains sensitive data.

</Tab>

<Tab>

- Under **Project settings**, click [**Credentials**](https://expo.dev/accounts/[account]/projects/[project]/credentials) in the navigation menu
- For **Android**, click **Add Application Identifier** or select an existing **Application identifier**
- Under **Service Credentials** > **FCM V1 service account key**, click **Add a service account key**

<ContentSpotlight
  alt="Project credentials page on expo.dev"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-1.png"
  className="max-w-[800px]"
/>

- Under **Upload new key**, upload your JSON credential and click **Save**

<ContentSpotlight
  alt="Save the service account key file to the project"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-2.png"
  className="max-w-[480px]"
/>

</Tab>

</Tabs>

</Step>

<Step label="4">

Configure the **google-services.json** file in your project. Download it from the Firebase Console and place it at the root of your project directory.

This file is required for your Android app to be registered with FCM. You may commit this file to your repository since it contains public-facing identifiers from your Firebase project.

**Note**: You can skip this step if **google-services.json** has already been set up.

<ContentSpotlight
  alt="Download google-services.json from Firebase Cloud Console"
  src="/static/images/creating-google-service-account/fcm-v1/existing-service-account/04-setup-google-services-json.png"
  className="max-w-[800px]"
/>

In **app.json**, add [`expo.android.googleServicesFile`](/versions/latest/config/app/#googleservicesfile) with its value as the path of the **google-services.json**.

```json app.json
{
  "expo": {
    /* @hide ...*/ /* @end */
    "android": {
      /* @hide ...*/ /* @end */ "googleServicesFile": "./path/to/google-services.json"
    }
  }
}
```

</Step>

<Step label="5">

You're all set! You can now send notifications to Android devices via Expo Push Notifications using the FCM V1 protocol.

<ContentSpotlight
  alt="Service account key successfully uploaded"
  src="/static/images/creating-google-service-account/fcm-v1/new-service-account/06-upload-credential-complete.png"
  className="max-w-[800px]"
/>

</Step>
